// axios 的基础封装
import axios from "axios"

const httpInstance = axios.create({
    baseURL: "http://pcapi-xiaotuxian-front-devtest.itheima.net",
    timeout: 5000
})

// 存在多个不同基地址
const httpInstance1 = axios.create({
    baseURL: "http://baidu.com",
    timeout: 5000
})

// 拦截器
// 请求拦截器
httpInstance.interceptors.request.use(config => {
    return config
}, e => Promise.reject(e))

// 相应拦截器
httpInstance.interceptors.response.use( res => res.data, e => {
    return Promise.reject(e)
})

// export default httpInstance
export {
    httpInstance,
    httpInstance1
}